package com.zeekr.orm.config;

import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 吴文杰
 * @version 1.0
 * @since 2024/7/12 19:39
 */
// @Configuration
// @EnableRabbit
public class UserServiceMQConfig {

  @Bean
  public DirectExchange directExchange() {
    return ExchangeBuilder.directExchange("user-service-exchange").build();
  }

  @Bean
  public Queue userServiceQueue() {
    return new Queue("user-service-queue");
  }

  @Bean
  public Binding binding() {
    Binding binding = BindingBuilder.bind(userServiceQueue()).to(directExchange()).with("user-service");
    return BindingBuilder.bind(userServiceQueue()).to(directExchange()).with("user-service");
  }

}
